package com.ksd.modules.members.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ksd.common.annotation.ApiLog;
import com.ksd.common.controller.BaseController;
import com.ksd.common.core.result.R;
import com.ksd.common.po.BatchIdsPO;
import com.ksd.common.web.annotation.RepeatSubmit;
import com.ksd.modules.members.po.AdminUserWalletIncomeSavePO;
import com.ksd.modules.members.po.AdminUserWalletIncomeSearchPO;
import com.ksd.modules.members.service.IAdminUserWalletIncomeService;
import com.ksd.modules.members.vo.AdminUserWalletIncomeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 平台up主用户 前端控制器
 * </p>
 *
 * @author Auto Generator
 * @since 2023-08-15
 */
@RestController
public class AdminUserWalletIncomeController extends BaseController {


    @Autowired
    private IAdminUserWalletIncomeService adminUserWalletIncomeService;

    /**
     * 查询首页钱包收入模板接口
     * @param adminUserWalletIncomeSearchPO
     * @return
     */
    @PostMapping("/users/wallet/income/list")
    public R<Page<AdminUserWalletIncomeVo>> findAdminUserWalletIncomes(@Validated @RequestBody AdminUserWalletIncomeSearchPO adminUserWalletIncomeSearchPO){
        return R.data(adminUserWalletIncomeService.findAdminUserWalletIncomes(adminUserWalletIncomeSearchPO));
    }

    /**
     * 【钱包收入】 - 保存和更新
     * @param adminUserWalletIncomesSavePO
     * @return
     */
    @PostMapping("/users/wallet/income/saveupdate")
    @ApiLog("【钱包收入】 - 保存和更新")
    @RepeatSubmit
    public R<AdminUserWalletIncomeVo> saveUpdateAdminUserWalletIncome(@Validated @RequestBody AdminUserWalletIncomeSavePO adminUserWalletIncomesSavePO){
        return R.data(adminUserWalletIncomeService.saveUpdateAdminUserWalletIncome(adminUserWalletIncomesSavePO));
    }

    /**
     * 【钱包收入】 - 根据id查询明细
     * @param id
     * @return
     */
    @PostMapping("/users/wallet/income/get/{id}")
    public R<AdminUserWalletIncomeVo> getAdminUserWalletIncomeById(@PathVariable("id")Long id){
        return R.data(adminUserWalletIncomeService.getAdminUserWalletIncomeById(id));
    }

    /**
     * 【钱包收入】- 批量物理删除
     *
     * @return
     */
    @PostMapping("/users/wallet/income/batch/remove")
    @ApiLog("【钱包收入】- 批量物理删除")
    @RepeatSubmit
    public R<Boolean> batchRemovesAdminUserWalletIncome(@RequestBody BatchIdsPO batchIdsPO) {
        return R.data(adminUserWalletIncomeService.batchRemovesAdminUserWalletIncome(batchIdsPO));
    }

    /**
     * 【钱包收入】- 根据ID恢复删除
     * @param id
     * @return
     */
    @PostMapping("/users/wallet/income/remove/{id}")
    @ApiLog("【钱包收入】- 根据ID恢复删除")
    public R<Boolean> removeAdminUserWalletIncomeById(@PathVariable("id")Long id){
        return R.data(adminUserWalletIncomeService.removeAdminUserWalletIncomeById(id));
    }
}
